import matplotlib.pyplot as plt
import numpy as np
from test0 import create_coordinate_system

# 创建一个坐标系
fig, ax = create_coordinate_system(x_range=(-10, 10), y_range=(-10, 10), figsize=(8, 8))

# 添加一个二次函数的图像
x = np.linspace(-1, 5, 100)
y = (x-2)**2 - 2 

# 关于Y轴对称，-((-x-2)**2 -2) = 2-(x+2)**2
x1 = np.linspace(-5, 1, 100)
y1 = 2-(x1+2)**2

# 绘制二次函数的图像
ax.plot(x, y, 'r-', linewidth=2, label='y = f(x)', color='black')
ax.plot(x1, y1, 'r-', linewidth=2, label='y = -f(-x)', color='red')

ax.legend()
plt.show()
